﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace SilverlightApplicationBibliothèquesLivres
{
    public class SingletonTypes
    {
        public static Types TypesStatic = new Types();
    }

    public class Types
    {
        public Type[] ListeTypes = new Type[0];

        public Types()
        {
        }

        public void CreationListeTypes(Type T)
        {
            Type[] temp = new Type[ListeTypes.Length + 1];
            ListeTypes.CopyTo(temp, 0);
            temp[temp.Length - 1] = T;
            ListeTypes = temp;
        }

        public void ChargerTypes()
        {
            /*
            ConnexionBDD.ConnectionBaseDonnées();

            ConnexionBDD.oDa.SelectCommand = ConnexionBDD.oConn.CreateCommand();
            ConnexionBDD.oDa.SelectCommand.CommandText = "SELECT*FROM Types;";
            DataSet ODS = new DataSet();
            ConnexionBDD.oDa.Fill(ODS, "Types");


            SingletonTypes.TypesStatic = new Types();
            foreach (DataRow r in ODS.Tables[0].Rows)
            {
                Type T = new Type();
                
                T.N_Type = Convert.ToInt32(r[0]);
                T.NomType = r[1].ToString();

                SingletonTypes.TypesStatic.CreationListeTypes(T);
            }*/

            /*if (ListeUpdated != null)
            {
                ListeUpdated(this, new UpdateEventArgs("Charger"));
            }*/
        }

    }
}
